package com.zs.admin.controller.wisdbook;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.google.common.collect.Maps;
import com.zs.admin.aop.Log;
import com.zs.admin.service.wisdbook.IWisdbookPageMarkService;
import com.zs.admin.validate.wisdbook.WisdbookPageMarkCreateValidate;
import com.zs.admin.validate.wisdbook.WisdbookPageMarkSearchValidate;
import com.zs.admin.validate.wisdbook.WisdbookPageMarkUpdateValidate;
import com.zs.admin.validate.commons.IdStrValidate;
import com.zs.admin.vo.wisdbook.WisdbookPageMarkDetailVo;
import com.zs.common.aop.DevNotLogin;
import com.zs.common.core.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.dongliu.requests.RawResponse;
import net.dongliu.requests.Requests;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;

@RestController
@RequestMapping("api/wisdbook/page/mark")
@Api(tags = "智书标记块数据管理")
public class WisdbookPageMarkController {

    @Resource
    IWisdbookPageMarkService iWisdbookPageMarkService;

    @PostMapping("/list")
    @ApiOperation(value="智书标记块数据列表")
    public AjaxResult list(@Validated @RequestBody WisdbookPageMarkSearchValidate searchValidate) {
        AjaxResult result = iWisdbookPageMarkService.list(searchValidate);
        return result;
    }


    @PostMapping("/listQuest")
    @ApiOperation(value="智书标记块数据列表")
    public AjaxResult listQuest(@Validated @RequestBody WisdbookPageMarkSearchValidate searchValidate) {
        AjaxResult result = iWisdbookPageMarkService.listQuest(searchValidate);
        return result;
    }

    @PostMapping("/detail")
    @ApiOperation(value="智书标记块数据详情")
    public AjaxResult<WisdbookPageMarkDetailVo> detail(@Validated @RequestBody IdStrValidate idStrValidate) {
        WisdbookPageMarkDetailVo detail = iWisdbookPageMarkService.detail(idStrValidate.getId());
        return AjaxResult.success(detail);
    }

    @Log(title = "智书标记块数据新增")
    @PostMapping("/add")
    @ApiOperation(value="智书标记块数据新增")
    public AjaxResult<Object> add(@Validated @RequestBody WisdbookPageMarkCreateValidate createValidate) {
        iWisdbookPageMarkService.add(createValidate);
        return AjaxResult.success();
    }

    @Log(title = "智书标记块数据编辑")
    @PostMapping("/edit")
    @ApiOperation(value="智书标记块数据编辑")
    public AjaxResult<Object> edit(@Validated @RequestBody WisdbookPageMarkUpdateValidate updateValidate) {
        iWisdbookPageMarkService.edit(updateValidate);
        return AjaxResult.success();
    }

    @Log(title = "智书标记块数据删除")
    @PostMapping("/del")
    @ApiOperation(value="智书标记块数据删除")
    public AjaxResult<Object> del(@Validated @RequestBody IdStrValidate idStrValidate) {
        iWisdbookPageMarkService.del(idStrValidate.getId());
        return AjaxResult.success();
    }




}
